<script>
	export default {
		onLaunch() {
			// 初始化登录信息
			this.initLoginUser();

			// 初始化购物车
			this.initCart();
		},
		methods: {
			initLoginUser() {
				uni.getStorage({
					key: 'loginUser',
					success: (e) => {
						e = e.data;
						if (e && e.token) {
							this.$store.commit('login', e);
						}
					}
				});
			},
			initCart() {
				uni.getStorage({
					key: 'cart',
					success: (e) => {
						e = e.data;
						if (e && e.length > 0) {
							this.$store.commit('initCart', e);
						}
					}
				});
			}
		}
	}
</script>

<style lang="scss">
	@import './common/styles/app.scss';

	* {
		outline: none;
		font-family: '微软雅黑';
	}

	body {
		height: auto;
		min-width: 1226px;
		overflow-x: auto;
	}

	a {
		text-decoration: none;
	}

	button {
		transition: all .4s;
		border-radius: 0;

		&:active {
			opacity: .8;
		}

		&:after {
			border: none;
		}
	}

	/* 图片显示模式 */
	.thumb {
		object-fit: contain;
	}

	/* 省略长文本 */
	.elip {
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}
</style>
